// 模块三（路由模块）：负责路由判断

// 加载handler.js
var handler = require('./handler.js')

module.exports = function(req,res){
    if (req.pathname === '/' || req.pathname === '/index' && req.method === 'get') {
        handler.index(req,res);
    }else if(req.pathname === '/submit' && req.method === 'get'){
        handler.submit(req,res);
    }else if(req.pathname === '/item' && req.method === 'get'){
        handler.item(req,res);
    }else if(req.pathname === '/add' && req.method === 'get'){
        handler.addGet(req,res);
    }else if(req.pathname === '/add' && req.method === 'post'){
        handler.addPost(req,res);
    }else if(req.url.startWidth('/resources') && req.method === 'get'){
        handler.staticSrc(req,res);
    }else {
        handler.NotFound(req,res);
    }
} 